<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>数组求和、数组最大值</title>
	</head>
	<body>
		<script>
			var arr=[];
			while(true){
				var num=parseInt(prompt("请输入数组"));
				arr.push(num);
				var choice=prompt("是否继续输入，结束输入no");
				if(choice=='no'){
					break;
				}
			}
			function getSum(arr){
				var sum=0;
				for(var i=0;i<arr.length;i++){
					sum+=arr[i];
				}
				return sum;
			}
			function getMax(arr){
				var max=Number.MIN_VALUE;
				for(var i=0;i<arr.length;i++){
					if(arr[i]>max){
						max=arr[i];
					}
				}
				return max;
			}
			console.log('数组求和='+getSum(arr));
			console.log('求最大值'+getMax(arr));
		</script>
	</body>
</html>
